import axios from 'axios'
import React from 'react'

const Index: React.FC = () => {
  const data = {
    // 订单号
    id: new Date().getTime(),
    // 订单金额
    price: 100.00,
    // 订单标题
    title: '手机'
  }

  const pay = async () => {
    const resp = await axios.get('/api/pay/pc', { params: data })
    console.log(resp.data)
    window.location.href = resp.data.data
  }
  
  return (
    <div>
      <h3>订单号： { data.id }</h3>
      <h3>订单金额： { data.price }</h3>
      <h3>订单标题： { data.title }</h3>
      <button onClick={() => pay()}>立即付款</button>
    </div>
  )
}

export default Index